package com.Ithema.d5_interface;

import java.util.ArrayList;

public class studentoperatorimpl implements studentoperator {
    @Override
    public void printallinfo(ArrayList<student> student) {
        System.out.println("---------全部信息---------");
        for (int i = 0; i < student.size(); i++) {
            student s = student.get(i);
            System.out.println("姓名" + s.getName() + "性别" + s.getGender() + "成绩" + s.getScore());
//            System.out.println(student.get(i));
        }
        System.out.println("----------------------");
    }

    @Override
    public void printaveragescore(ArrayList<student> student) {
        double averagescore = 0;
        for (int i = 0; i < student.size(); i++) {
            student s = student.get(i);
            averagescore += s.getScore();
        }
        System.out.println("平均分" + averagescore / student.size());
    }
}
